<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <form action="/addUser" method="POST">
    <p><input type="text" name="name"/></p>
    <p><input type="text" name="age"/></p>
    <p><input type="submit" value="submit"/></p>
  </form>

</body>

<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.0/jquery.js"></script>
<h1 id='result'>result</h1>
<script>
var data = JSON.stringify({'name':'zhangsan', 'age':'20'});
$.ajax({
    url: '/api/addUser',
    type: 'post',
    contentType:'application/json',
    data: data,
  　success: function(data) {
        $("#result").html(data);
    },
    error: function(e) {
        alert('ERROR')
    }
});
</script>

</html>
